package com.threaddemo7;


public class UnReentryLock {
    private boolean isLocked = false;
    public synchronized void lock() throws InterruptedException{
        while(isLocked){
            wait();
        }
        isLocked = true;//设置成true说明拿到锁了
    }
    public synchronized void unlock(){
        isLocked = false;
        notify();
    }
}
